<%@ page language="java" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="tag" prefix="PF" %>
<%--
  ~ This file Copyright (c) 2015. Walle.
  ~ (http://www.wallellen.com). All rights reserved.
  ~
  ~
  ~ This file is dual-licensed under both the
  ~ Walle Agreement (WA) and the GNU General Public License.
  ~ You may elect to use one or the other of these licenses.
  ~
  ~ This file is distributed in the hope that it will be
  ~ useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
  ~ implied warranty of MERCHANTABILITY or FITNESS FOR A
  ~ PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
  ~ Redistribution, except as permitted by whichever of the GPL
  ~ or WA you select, is prohibited.
  ~
  ~ 1. For the GPL license (GPL), you can redistribute and/or
  ~ modify this file under the terms of the GNU General
  ~ Public License, Version 3, as published by the Free Software
  ~ Foundation.  You should have received a copy of the GNU
  ~ General Public License, Version 3 along with this program;
  ~ if not, write to the Free Software Foundation, Inc., 51
  ~ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  ~
  ~ 2. For the Walle Agreement (WA), this file
  ~ and the accompanying materials are made available under the
  ~ terms of the WA which accompanies this distribution, and
  ~ is available at http://www.wallellen.com/agreement.html
  ~
  ~
  ~ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
  --%>

<script src="text/javascript/highstock.1.1.js"></script>
<script type="text/javascript">
    $(function () {
        $.getJSON('webstat/PubStatAll.html', function (data) {
            var color = {
                linearGradient: {
                    x1: 0,
                    y1: 0,
                    x2: 0,
                    y2: 1
                },
                stops: [
                    [ 0, Highcharts.getOptions().colors[0] ],
                    [
                        1,
                        Highcharts.Color(
                                Highcharts.getOptions().colors[0])
                                .setOpacity(0).get('rgba') ]
                ]
            };
            var groupingUnits = [
                [ 'week', // unit name
                    [ 1 ] // allowed multiples
                ],
                [ 'month', [ 1, 2, 3, 4, 6 ] ]
            ];
            $('#container').highcharts('StockChart', {
                rangeSelector: {
                    selected: 1,
                    inputEnabled: $('#container').width() > 480
                },
                yAxis: [
                    {
                        labels: {
                            align: 'right',
                            x: -3
                        },
                        title: {
                            text: '文档总量统计'
                        },
                        height: '60%',
                        lineWidth: 2
                    },
                    {
                        labels: {
                            align: 'right',
                            x: -3
                        },
                        title: {
                            text: '每日发布统计'
                        },
                        top: '65%',
                        height: '35%',
                        offset: 0,
                        lineWidth: 2
                    }
                ],
                series: [
                    {
                        name: '累计文档数量',
                        data: data.nums.TotalNum,
                        tooltip: {
                            valueDecimals: 2
                        },
                        type: 'areaspline',
                        marker: {
                            enabled: true,
                            radius: 3
                        },
                        shadow: true,
                        fillColor: color
                    },
                    {
                        name: '当天发布数量',
                        data: data.nums.DayNum,
                        type: 'column',
                        yAxis: 1,
                        tooltip: {
                            valueDecimals: 2
                        },
                        dataGrouping: {
                            units: groupingUnits
                        }
                    },
                    {
                        name: '累计好评文档',
                        data: data.nums.GoodNum,
                        shadow: true
                    },
                    {
                        name: '累计差评文档',
                        data: data.nums.BadNum,
                        shadow: true
                    }
                ]
            });
        });
    });
</script>
<div class="panel panel-default" style="background-color: #FCFCFA;">
    <div class="panel-body">
        <p>
            <span class="glyphicon glyphicon-stats  ">使用分析</span>
        </p>
        <hr/>
        <div class="panel panel-default" style="background-color: white;">
            <div class="panel-body">
                <div id="container">加载中... ...</div>
            </div>
        </div>
    </div>
</div>